#include <iostream>
#include <signal.h>
#include <unistd.h>

void handler(int sigNo)
{
    std::cout<<"信号编号："<<sigNo<<std::endl;
    exit(1);
}

int main()
{
    struct sigaction newSig,oldSig;
    newSig.sa_handler = handler;
    sigaction(SIGINT,&newSig,&oldSig);

    while (true)
    {
        /* code */
        std::cout<<"zzzzzzzzzz"<<std::endl;
        sleep(1);
    }
    

    return 0;
}